<jsp:directive.include file="/jsp/includes/taglibs.jsp" />

<script type="text/javascript">

	var comment_load_url = "<c:url value="/comments/load"/>";
	var comment_tag_url = "<c:url value="/comments/tag"/>";

</script>

<a href="#" onclick="return reply()"><spring:message code="comment.new"/></a>
<br/><br/>
<c:forEach items="${ comments }" var="comment">
	<div class="commentRoot">
		<c:set var="comment" value="${comment}" scope="request"/>
		<c:set var="loadChildren" value="true" scope="request"/>  
		<jsp:include page="/jsp/includes/comment.jsp"/>
	</div>
</c:forEach>

<div id="replyForm" style="display: none">
	<form:form commandName="commentSubmitCommand">	
		<form:hidden path="parentId"/>

 		<form:label path="title"><spring:message code="comment.post.title"/></form:label> 
 		<form:input path="title"/> <form:errors path="title" cssClass="error"/>
  		<br/><br/>
		
		<form:textarea path="text" rows="10" cols="60"/> <form:errors path="text" cssClass="error"/>    	
  		<br/><br/>

 		<form:label path="tags"><spring:message code="comment.post.tags"/></form:label> 
 		<form:input path="tags"/> <form:errors path="tags" cssClass="error"/>
  		<br/><br/>
		<c:forEach items="${flags}" var="flag" varStatus="status">
			<form:label cssClass="checkbox" path="flags"><form:checkbox cssClass="flag" path="flags" value="${flag.id}"/> ${flag.name}</form:label>
		</c:forEach>
		<br/>
		<div style="text-align: right">
			<input type="submit" value="<spring:message code="comment.post.submit"/>"/>
		</div>
	</form:form>
</div>